const getImg = function(shareType,userInfo,list,codeImg,redColor){
	let painting = {}
	let https = userInfo.avatarUrl.substring(0,5);
	let avatarUrl = ''
	if(https === 'https'){
		avatarUrl = userInfo.avatarUrl
	}else{
		if(userInfo.avatarUrl.indexOf('http://thirdwx.qlogo.cn') != -1){
			avatarUrl = userInfo.avatarUrl.replace('http://thirdwx.qlogo.cn', 'https://wx.qlogo.cn')
		}
	}
	console.log(avatarUrl)
	if(shareType == 'goods'){
		var goodsImg = list.top_img[0].type == 'pic'?list.top_img[0].url.replace('http','https'):list.top_img[1].url.replace('http','https')
		painting = {
			width: 375,
			height: 534,
			background: '#ffffff',
			clear: true,
			views: [
				{
					type: 'rect',
					background: '#ffffff',
					top: 0,
					left: 0,
					width: 375,
					height: 534
				},
				{
					type: 'image',
					url: goodsImg,
					top: 0,
					left: 0,
					width: 375,
					height: 375
				},
				{
					type: 'text',
					content: list.product_name,
					fontSize: 16,
					lineHeight: 21,
					color: '#333333',
					textAlign: 'left',
					top: 385,
					left: 15,
					width: 335,
					MaxLineNumber: 2,
					breakWord: true,
					bolder: true
				},
				{
					type: 'text',
					content: '现价￥',
					fontSize: 16,
					color: redColor,
					textAlign: 'left',
					top: 430,
					left: 15,
				},
				{
					type: 'text',
					content: list.price,
					fontSize: 24,
					color: redColor,
					textAlign: 'left',
					top: 425,
					left: 65,
					bolder: true
				},
				{
					type: 'text',
					content: '原价',
					fontSize: 16,
					color: '#666666',
					textAlign: 'left',
					top: 455,
					left: 15,
				},
				{
					type: 'text',
					content: '￥' + list.old_price,
					fontSize: 16,
					color: '#666666',
					textAlign: 'left',
					top: 455,
					left: 60,
					textDecoration: 'line-through'
				},
				{
					type: 'image',
					url: avatarUrl,
					top: 485,
					left: 15,
					width: 37,
					height: 37,
				},
				{
					type: 'image',
					url: 'https://oss.freei.cc/5e8186a4ad7a9.png',
					top: 483,
					left: 13,
					width: 40,
					height: 40,
				},
				{
					type: 'text',
					content: `您的好友【${userInfo.nickName}】`,
					fontSize: 16,
					color: '#333333',
					textAlign: 'left',
					top: 485,
					left: 60,
					bolder: true
				},
				{
					type: 'text',
					content: '发现一件好货，赶快进来看看~~~',
					fontSize: 14,
					color: '#666666',
					textAlign: 'left',
					top: 505,
					left: 60
				},
				
				{
					type: 'image',
					url: codeImg,
					top: 440,
					left: 290,
					width: 65,
					height: 65
				},
				{
					type: 'text',
					content: '长按识别',
					fontSize: 14,
					color: '#333333',
					textAlign: 'left',
					top: 505,
					left: 295,
					width: 50,
					breakWord: true
				}
			]
		}
	}else if(shareType == 'goodsShop'){
		painting = {
			width: 375,
			height: 555,
			clear: true,
			views: [
				{
					type: 'image',
					url: 'https://oss.freei.cc/5e215be17cee2.png',
					top: 0,
					left: 0,
					width: 375,
					height: 555
				},
				{
					type: 'image',
					url: avatarUrl,
					top: 27.5,
					left: 29,
					width: 55,
					height: 55
				},
				{
					type: 'image',
					url: 'https://oss.freei.cc/5e2156c9edf81.png',
					top: 27.5,
					left: 29,
					width: 55,
					height: 55
				},
				{
					type: 'text',
					content: `您的好友【${userInfo.nickName}】`,
					fontSize: 16,
					color: '#000000',
					textAlign: 'left',
					top: 33,
					left: 96,
					bolder: true
				},
				{
					type: 'text',
					content: '发现一间好店，赶快进来看看~~~',
					fontSize: 15,
					color: '#333333',
					textAlign: 'left',
					top: 59.5,
					left: 96
				},
				{
					type: 'image',
					url: list.supplier.back_img.replace('http','https'),
					top: 136,
					left: 42.5,
					width: 290,
					height: 190
				},
				{
					type: 'image',
					url: list.supplier.supplier_img.replace('http','https'),
					top: 300,
					left: 160,
					width: 50,
					height: 50
				},
				{
					type: 'image',
					url: codeImg,
					top: 443,
					left: 85,
					width: 68,
					height: 68
				},
				{
					type: 'text',
					content: list.supplier.supplier_name,
					fontSize: 16,
					lineHeight: 21,
					color: '#333333',
					textAlign: 'center',
					top: 360,
					left: 180,
					width: 290,
					bolder: true
				},
				{
					type: 'text',
					content: list.supplier.supplier_content,
					fontSize: 16,
					color: '#333333',
					textAlign: 'center',
					top: 385,
					left: 180,
					width: 290,
					bolder: true,
					MaxLineNumber: 2,
					breakWord: true,
				},
				// {
				// 	type: 'text',
				// 	content: '原价:￥138.00',
				// 	fontSize: 13,
				// 	color: '#7E7E8B',
				// 	textAlign: 'left',
				// 	top: 391,
				// 	left: 110,
				// 	textDecoration: 'line-through'
				// },
				{
					type: 'text',
					content: '长按识别图中二维码进来瞧瞧呗~',
					fontSize: 14,
					color: '#333333',
					textAlign: 'left',
					top: 460,
					left: 165.5,
					lineHeight: 20,
					MaxLineNumber: 2,
					breakWord: true,
					width: 125
				}
			]
		}
	}else if(shareType == 'shop'){
		painting = {
			width: 375,
			height: 555,
			clear: true,
			views: [
				{
					type: 'image',
					url: 'https://oss.freei.cc/5e215be17cee2.png',
					top: 0,
					left: 0,
					width: 375,
					height: 555
				},
				{
					type: 'image',
					url: avatarUrl,
					top: 27.5,
					left: 29,
					width: 55,
					height: 55
				},
				{
					type: 'image',
					url: 'https://oss.freei.cc/5e2156c9edf81.png',
					top: 27.5,
					left: 29,
					width: 55,
					height: 55
				},
				{
					type: 'text',
					content: `您的好友【${userInfo.nickName}】`,
					fontSize: 16,
					color: '#000000',
					textAlign: 'left',
					top: 33,
					left: 96,
					bolder: true
				},
				{
					type: 'text',
					content: '发现一间好店，赶快进来看看~~~',
					fontSize: 15,
					color: '#333333',
					textAlign: 'left',
					top: 59.5,
					left: 96
				},
				{
					type: 'image',
					url: list.back_img.replace('http','https'),
					top: 136,
					left: 42.5,
					width: 290,
					height: 190
				},
				{
					type: 'image',
					url: list.supplier_img.replace('http','https'),
					top: 300,
					left: 160,
					width: 50,
					height: 50
				},
				{
					type: 'image',
					url: codeImg,
					top: 443,
					left: 85,
					width: 68,
					height: 68
				},
				{
					type: 'text',
					content: list.supplier_name,
					fontSize: 16,
					lineHeight: 21,
					color: '#333333',
					textAlign: 'center',
					top: 360,
					left: 180,
					width: 290,
					bolder: true
				},
				{
					type: 'text',
					content: list.supplier_content,
					fontSize: 16,
					color: '#333333',
					textAlign: 'center',
					top: 385,
					left: 180,
					width: 290,
					bolder: true,
					MaxLineNumber: 2,
					breakWord: true,
				},
				// {
				// 	type: 'text',
				// 	content: '原价:￥138.00',
				// 	fontSize: 13,
				// 	color: '#7E7E8B',
				// 	textAlign: 'left',
				// 	top: 391,
				// 	left: 110,
				// 	textDecoration: 'line-through'
				// },
				{
					type: 'text',
					content: '长按识别图中二维码进来瞧瞧呗~',
					fontSize: 14,
					color: '#333333',
					textAlign: 'left',
					top: 460,
					left: 165.5,
					lineHeight: 20,
					MaxLineNumber: 2,
					breakWord: true,
					width: 125
				}
			]
		}
	}else if(shareType == 'fxShop'){
		painting = {
			width: 375,
			height: 555,
			clear: true,
			views: [
				{
					type: 'image',
					url: 'https://oss.freei.cc/5e215be17cee2.png',
					top: 0,
					left: 0,
					width: 375,
					height: 555
				},
				{
					type: 'image',
					url: avatarUrl,
					top: 27.5,
					left: 29,
					width: 55,
					height: 55
				},
				{
					type: 'image',
					url: 'https://oss.freei.cc/5e2156c9edf81.png',
					top: 27.5,
					left: 29,
					width: 55,
					height: 55
				},
				{
					type: 'text',
					content: `您的好友【${userInfo.nickName}】`,
					fontSize: 16,
					color: '#000000',
					textAlign: 'left',
					top: 33,
					left: 96,
					bolder: true
				},
				{
					type: 'text',
					content: '发现一间好店，赶快进来看看~~~',
					fontSize: 15,
					color: '#333333',
					textAlign: 'left',
					top: 59.5,
					left: 96
				},
				{
					type: 'image',
					url: list.back_img.replace('http','https'),
					top: 136,
					left: 42.5,
					width: 290,
					height: 190
				},
				{
					type: 'image',
					url: list.head_img.replace('http','https'),
					top: 300,
					left: 160,
					width: 50,
					height: 50
				},
				{
					type: 'image',
					url: codeImg,
					top: 443,
					left: 85,
					width: 68,
					height: 68
				},
				{
					type: 'text',
					content: list.shop_name,
					fontSize: 16,
					lineHeight: 21,
					color: '#333333',
					textAlign: 'center',
					top: 360,
					left: 180,
					width: 290,
					bolder: true
				},
				{
					type: 'text',
					content: list.shop_content,
					fontSize: 16,
					color: '#333333',
					textAlign: 'center',
					top: 385,
					left: 180,
					width: 290,
					bolder: true,
					MaxLineNumber: 2,
					breakWord: true,
				},
				// {
				// 	type: 'text',
				// 	content: '原价:￥138.00',
				// 	fontSize: 13,
				// 	color: '#7E7E8B',
				// 	textAlign: 'left',
				// 	top: 391,
				// 	left: 110,
				// 	textDecoration: 'line-through'
				// },
				{
					type: 'text',
					content: '长按识别图中二维码进来瞧瞧呗~',
					fontSize: 14,
					color: '#333333',
					textAlign: 'left',
					top: 460,
					left: 165.5,
					lineHeight: 20,
					MaxLineNumber: 2,
					breakWord: true,
					width: 125
				}
			]
		}
	}else if(shareType == 'shopCode'){
		painting = {
			width: 690,
			height: 1000,
			clear: true,
			views: [
				{
					type: 'rect',
					background: '#ffffff',
					top: 0,
					left: 0,
					width: 690,
					height: 1000,
				},
				{
					type: 'image',
					url: list.head_img.replace('http','https'),
					top: 55,
					left: 95,
					width: 100,
					height: 100,
				},
				{
					type: 'text',
					content: list.shop_name,
					fontSize: 28,
					lineHeight: 20,
					color: '#000000',
					textAlign: 'left',
					top: 100,
					left: 220,
					width: 290,
				},
				{
					type: 'image',
					url: codeImg,
					top: 200,
					left: 95,
					width: 500,
					height: 500
				},
				{
					type: 'text',
					content: '长按识别图中二维码,进入店铺',
					fontSize: 26,
					color: '#999999',
					textAlign: 'center',
					top: 760,
					left: 345,
					lineHeight: 20,
					width: 290
				}
			]
		}
	}
	return painting
}

export default{
	getImg: getImg
}